package com.daohang361.imqq.encoder;

import com.daohang361.imqq.Asycore.QQUser;
import com.daohang361.imqq.tool.ByteArray;
import com.daohang361.imqq.tool.MyUtil;

public class EncoderEB extends AbstractEncoder {
	/**
	 * 协议格式:
	 * 01000000000000000000${sequence}
	 * @author naner
	 */
		@Override
		public byte[] encode(QQUser myqq, int command) {
			ByteArray myByte = doHead(myqq, "00EB");
			myByte.saveThis();//保存此段作为第0段
			
			
			int friendTotalPage=0;
			int firendCurrentPage=0;
			
			try {
				friendTotalPage = MyUtil.byte2Int(myqq.getAttr("friendTotalPage")[0]);//总片段
				firendCurrentPage = MyUtil.byte2Int(myqq.getAttr("firendCurrentPage")[0]);//当前片段
				System.out.println("EB总页数:" + friendTotalPage + "当前第"	+ firendCurrentPage + "页.");
			} catch (Exception e) {
			}
			
			myByte.putHex("01000000000000000000");
			myByte.putInt(firendCurrentPage+1);
		
			myByte.saveThis();//保存此段作为第一段
			
			myByte.teaThis(1, 1,myqq.getAttr("SessionKey"));//加密第一段到第一段
			
			doTail(myByte);
			return myByte.getByteList();//返回完整的package
		}
}
